
import java.util.Date;
import java.util.List;

import com.restfb.Connection;
import com.restfb.DefaultFacebookClient;
import com.restfb.Facebook;
import com.restfb.FacebookClient;
import com.restfb.FacebookClient.AccessToken;
import com.restfb.Parameter;
import com.restfb.types.FacebookType;
import com.restfb.types.Message;
import com.restfb.types.Page;
import com.restfb.types.Post;
import com.restfb.types.User;

public class Main 
{
	public static void main (String[] args)
	{
        String app_ID="576051705777921";
        String app_Secret="816125eca95b5c2cef1ac84258f3ac6c";
        
        String url_facebook="http://www.facebook.com/";
        AccessToken access_token =
        		  new DefaultFacebookClient().obtainAppAccessToken(app_ID, app_Secret);
        FacebookClient fc= new DefaultFacebookClient(
  "https://graph.facebook.com/oauth/access_token?client_id="+app_ID+"&client_secret="+app_Secret+"&grant_type=client_credentials");
//"https://graph.facebook.com/oauth/access_token?client_id=576051705777921&client_secret=816125eca95b5c2cef1ac84258f3ac6c&grant_type=client_credentials");
//https://graph.facebook.com/oauth/access_token?" + "client_id=" + APP_ID + "&client_secret=" + APP_SEC + "&grant_type=client_credentials"
        //String access_token="576051705777921|erFR_6LS02JKLEPUL2e5WqZfji4";
        String access_token_comedor_me="CAAIL6n1LjwEBABkYtXnXpEXqkGh8r4JzVxfBqEpbYHdtZC5yuPZAr8klZArn2WPdk5BnSD5DA4GceEfmO6aQx3QjISRM9bc0xNUAXrpj3oaSdA0CBq3uVGuwU8ZCO3ZBA1rS4K96bMT1eCo7jRnUc9rCcFdcNTeB3FDAxWSo9N7nk4fv5NlX93BYtNm7vPz81RiqGIrtdmAZDZD";
        FacebookClient fbc= new DefaultFacebookClient(access_token.getAccessToken());
        //FacebookClient fbc= new DefaultFacebookClient();

        String redirectUrl = "https://www.facebook.com/pages/Comedor-ESPOL/611821072209635?skip_nax_wizard=true";
        String returnValue = "https://www.facebook.com/dialog/oauth?client_id="
                + "576051705777921" + "&redirect_uri=" + redirectUrl
                + "&scope=email,user_birthday&state=";
        	
        String idPagina="576051705777921";
        com.facebook.android.Facebook face= new com.facebook.android.Facebook(app_ID); 

        
        //User usuario= fbc.fetchObject("me", User.class);
         
        //User userWithMetadata = fbc.fetchObject("me", User.class, Parameter.with("metadata", 1));
        Page page= fbc.fetchObject(idPagina, Page.class);
        //User usuario= fbc.fetchObject("me", User.class);
        System.out.println(page.getName());
        
        //fbc.publish("576051705777921", FacebookType.class, Parameter.with("message", "Caldo"));		
        	
        /*
        Connection<Post> filteredFeed = fbc.fetchConnection("576051705777921/", Post.class,
        		  Parameter.with("limit", 3), Parameter.with("message", "yesterday"));
*/
        

        //System.out.println(myFeed.getData().get(0).getMessage());
        

	}
}